package me.jiatao.wan.data.network

import com.google.gson.annotations.SerializedName

/**
 * @Author: taojia
 * @CreateDate: 2021/8/24 3:50 下午
 * @Version: 1.0
 * @Description: http访问响应数据包装类
 */

/**
 * 网络相关常量
 */
sealed class HttpConst {
    companion object {
        //业务逻辑类
        const val CODE_SUCCESS = 0
        const val CODE_TOKEN_INVALID = 400

        //网络访问类
        const val CODE_DATA_NULL = 400
        const val CODE_NET_ERROR = 401
        const val CODE_TIMEOUT = 402
        const val CODE_JSON_PARSE_ERROR = 403
        const val CODE_SERVER_ERROR = 500

        const val MSG_NET_ERROR = "网络连接失败,请检测网络设置"
        const val MSG_OPERATION_FAILURE = "操作失败,请稍候重试"
    }
}

data class HttpResult<T> constructor(
    @SerializedName("errorCode")
    var code: Int = -1,
    @SerializedName("errorMsg")
    var message: String? = "",
    @SerializedName("data")
    var data: T? = null
)